package com.dfqy.service;



import com.dfqy.dao.AdminDAO;
import com.dfqy.pojo.Admin;
import com.dfqy.vo.Page;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;


@Service
public class AdminService {

    @Autowired
    private AdminDAO dao;

    public int add(Admin admin){
        int add = dao.add(admin);
        return add;
    }

    public int delete(long... id) {
        int delete = dao.delete(id);
        return delete;
    }

    public int update(Admin admin) {
        int update = dao.update(admin);
        return update;
    }

    public Page<Admin> paging(int pageNo, int pageSize, String uname) {
        List<Admin> list = dao.paging(pageNo, pageSize,uname);
        int total=dao.findTotal(uname);
        return new Page<>(list,pageNo,total,pageSize);
    }

    public Admin getInfoById(long id) {
        return dao.selectAdminById(id);
    }
}
